{% load hc_extras humanize linemode %}{% linemode %}

{% line %}The check "{{ check.name_then_code|safe }}" has gone {{ flip.new_status }}.{% endline %}
{% if flip.reason == "timeout" %}
{% line %}Reason: success signal did not arrive on time, grace time passed.{% endline %}
{% elif flip.reason == "fail" %}
{% line %}Reason: received a failure signal.{% endline %}
{% endif %}
{% line %}{% endline %}

{% line %}View on {% site_name %}:{% endline %}
{% line %}{{ check.cloaked_url }}{% endline %}

{% if check.desc %}
{% line %}{% endline %}
{% line %}Description:{% endline %}
{% line %}------------{% endline %}
{% line %}{{ check.desc|safe}}{% endline %}
{% endif %}

{% line %}{% endline %}
{% line %}Details:{% endline %}
{% line %}--------{% endline %}

{% if check.project.name %}
    {% line %}Project: {{ check.project.name|safe }}{% endline %}
{% endif %}

{% if check.tags %}
    {% line %}Tags: {{ check.tags|safe }}{% endline %}
{% endif %}

{% if check.kind == "simple" %}
    {% line %}Period: {{ check.timeout|hc_duration }}{% endline %}
{% endif %}

{% if check.kind == "cron" or check.kind == "oncalendar" %}
    {% line %}Schedule: {{ check.schedule }}{% endline %}
    {% line %}Time zone: {{ check.tz }}{% endline %}
{% endif %}

{% line %}Total pings: {% if ping %}{{ ping.n }}{% else %}0{% endif %} {% if check.created %}(since {{ check.created|date:'M j, Y' }}){% endif %}{% endline %}

{% if ping %}
    {% line %}Last ping: {{ ping.created|naturaltime }}{% if ping.remote_addr %}, from {{ ping.remote_addr }}{% endif %}{% endline %}

    {% line %}Last ping type: {{ ping.get_kind_display }}{% endline %}
    {% if subject %}
    {% line %}Last ping subject: {{ subject }}{% endline %}
    {% endif %}
{% endif %}

{% line %}Status changed to {{ flip.new_status }} at: {{ flip.created|date:"Y-m-d H:i:s T" }}{% endline %}

{% if ping and ping.has_body %}
    {% line %}{% endline %}
    {% line %}Last Ping Body:{% endline %}
    {% line %}---------------{% endline %}
    {% if body is None %}
        {% line %}The request body data is being processed and will be available for viewing shortly.{% endline %}
        {% line %}Please view it on the website.{% endline %}
    {% else %}
        {% line %}{{ body|safe|slice:":10000"|wordwrap:80 }}{% endline %}
        {% if body|length > 10000 %}
            {% line %}[truncated]{% endline %}
        {% endif %}
    {% endif %}
{% endif %}

{% if projects %}
    {% line %}{% endline %}
    {% line %}Projects Overview:{% endline %}
    {% line %}------------------{% endline %}

    {% for project in projects %}
        {% with project.get_n_down as n_down %}
            {{ project }} ({{ project.checks_url }})
            {% if n_down %}
                {% line %}* {{ project|safe }}: {{ n_down }} check{{ n_down|pluralize }} down{% endline %}
            {% else %}
                {% line %}* {{ project|safe }}: OK, all checks up{% endline %}
            {% endif %}
        {% endwith %}
    {% endfor %}
{% endif %}

{% line %}{% endline %}
{% line %}--{% endline %}
{% line %}Unsubscribe: {{ unsub_link }}{% endline %}
{% line %}Regards, {% site_name %}{% endline %}
{% endlinemode %}
